// app.js
import './utils/index'
import './utils/http'
wx.utils.toast()
// import utils from './utils/index'
// utils.toast()
App({
  onLaunch() {
    this.getToken()
  },
  token:'',
  refreshToken:'',
  userInfo:{
    avatar:'',
    nickName:''
  },
  globalData: {},
  getToken() {
    wx.getStorage({
      key:'token',
      success:(res) =>{
        this.token =  res.data
      }
    })
    this.refreshToken = wx.getStorageSync('refreshToken')
  },
  setToken(token,refreshToken) {
    this.token =  'Bearer ' + token
    this.refreshToken =  'Bearer ' + refreshToken
    // wx本地存储
    wx.setStorage({
      key:'token',
      data:'Bearer ' + token
    })
    wx.setStorage({
      key:'refreshToken',
      data:'Bearer ' + refreshToken
    })
  }
})
